<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkLinkButton</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="ButtonWidgets.html" title="按钮和开关">
<link rel="prev" href="gtk3-GtkToggleButton.html" title="GtkToggleButton">
<link rel="next" href="gtk3-GtkScaleButton.html" title="GtkScaleButton">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-GtkToggleButton.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ButtonWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="gtk3-GtkScaleButton.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-GtkLinkButton.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-GtkLinkButton.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-GtkLinkButton"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkLinkButton.top_of_page"></a>GtkLinkButton</span></h2>
<p>GtkLinkButton — Create buttons bound to a URL</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-GtkLinkButton.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton">GtkLinkButton</a>;
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-new" title="gtk_link_button_new ()">gtk_link_button_new</a>                 (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-new-with-label" title="gtk_link_button_new_with_label ()">gtk_link_button_new_with_label</a>      (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label</code></em>);
const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-get-uri" title="gtk_link_button_get_uri ()">gtk_link_button_get_uri</a>             (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-set-uri" title="gtk_link_button_set_uri ()">gtk_link_button_set_uri</a>             (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-get-visited" title="gtk_link_button_get_visited ()">gtk_link_button_get_visited</a>         (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-set-visited" title="gtk_link_button_set_visited ()">gtk_link_button_set_visited</a>         (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> visited</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkLinkButton.description"></a><h2>Description</h2>
<p>
A GtkLinkButton is a <a class="link" href="gtk3-GtkButton.html#GtkButton" title="struct GtkButton"><span class="type">GtkButton</span></a> with a hyperlink, similar to the one
used by web browsers, which triggers an action when clicked. It is useful
to show quick links to resources.
</p>
<p>
A link button is created by calling either <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-new" title="gtk_link_button_new ()"><code class="function">gtk_link_button_new()</code></a> or
<a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-new-with-label" title="gtk_link_button_new_with_label ()"><code class="function">gtk_link_button_new_with_label()</code></a>. If using the former, the URI you pass
to the constructor is used as a label for the widget.
</p>
<p>
The URI bound to a GtkLinkButton can be set specifically using
<a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-set-uri" title="gtk_link_button_set_uri ()"><code class="function">gtk_link_button_set_uri()</code></a>, and retrieved using <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-get-uri" title="gtk_link_button_get_uri ()"><code class="function">gtk_link_button_get_uri()</code></a>.
</p>
<p>
By default, GtkLinkButton calls <a class="link" href="gtk3-Filesystem-utilities.html#gtk-show-uri" title="gtk_show_uri ()"><code class="function">gtk_show_uri()</code></a> when the button is
clicked. This behaviour can be overridden by connecting to the
<span class="type">"activate-link"</span> signal and returning <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from the
signal handler.
</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkLinkButton.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkLinkButton"></a><h3>struct GtkLinkButton</h3>
<pre class="programlisting">struct GtkLinkButton {
};
</pre>
<p>
The <span class="structname">GtkLinkButton</span> structure contains only
private data and should be accessed using the provided API.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-new"></a><h3>gtk_link_button_new ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_link_button_new                 (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> with the URI as its text.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>a valid URI</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new link button widget.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-new-with-label"></a><h3>gtk_link_button_new_with_label ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_link_button_new_with_label      (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label</code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> containing a label.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>a valid URI</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td>
<td>the text of the button. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new link button widget. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-get-uri"></a><h3>gtk_link_button_get_uri ()</h3>
<pre class="programlisting">const <a href="../glib/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       gtk_link_button_get_uri             (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>);</pre>
<p>
Retrieves the URI set using <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-set-uri" title="gtk_link_button_set_uri ()"><code class="function">gtk_link_button_set_uri()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>link_button</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a valid URI.  The returned string is owned by the link button
and should not be modified or freed.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-set-uri"></a><h3>gtk_link_button_set_uri ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_link_button_set_uri             (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *uri</code></em>);</pre>
<p>
Sets <em class="parameter"><code>uri</code></em> as the URI where the <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> points. As a side-effect
this unsets the 'visited' state of the button.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>link_button</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>a valid URI</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-get-visited"></a><h3>gtk_link_button_get_visited ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_link_button_get_visited         (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>);</pre>
<p>
Retrieves the 'visited' state of the URI where the <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
points. The button becomes visited when it is clicked. If the URI
is changed on the button, the 'visited' state is unset again.
</p>
<p>
The state may also be changed using <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-set-visited" title="gtk_link_button_set_visited ()"><code class="function">gtk_link_button_set_visited()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>link_button</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the link has been visited, <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-link-button-set-visited"></a><h3>gtk_link_button_set_visited ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_link_button_set_visited         (<em class="parameter"><code><a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a> *link_button</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> visited</code></em>);</pre>
<p>
Sets the 'visited' state of the URI where the <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
points.  See <a class="link" href="gtk3-GtkLinkButton.html#gtk-link-button-get-visited" title="gtk_link_button_get_visited ()"><code class="function">gtk_link_button_get_visited()</code></a> for more details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>link_button</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkLinkButton.html#GtkLinkButton" title="struct GtkLinkButton"><span class="type">GtkLinkButton</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>visited</code></em> :</span></p></td>
<td>the new 'visited' state</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
<div class="refsect1">
<a name="gtk3-GtkLinkButton.see-also"></a><h2>See Also</h2>
<a class="link" href="gtk3-GtkButton.html#GtkButton" title="struct GtkButton"><span class="type">GtkButton</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>